Module handle if open from name string?

This is probably a very basic question but...
 

//I know a module's name:
string mname="/project1/module1"
//I can get from this a ModName_ handle from the string:
ModName_ mnhModule=module(mname)
//So I can test to ensure this is a valid module and see if it is open...
if ( (! null mnhModule) && (open(mnhModule) )
{
    //QUESTION:
    //Now how do I get a "Module"-type handle for this open module?
    //Do I have to open it?
    //If so, can I first get the current open mode (read/write/shared)and visibility? 
    //(from just the ModName_ handle and module name string)
}
//

strathglass - Mon Mar 07 06:25:48 EST 2011

Re: Module handle if open from name string?
SystemAdmin - Mon Mar 07 17:01:56 EST 2011

If I've understood you correctly - the following will provide a module handle to the module variable "m". Then you can check for the open mode of the module.
 

string mname="/project1/module1"
ModName_ mnhModule=module(mname)
Module m
if ((!null(mnhModule)) && (open(mnhModule))) {
    m = module(item(mname))
        if (isEdit(m)) print m."Name" " is in EXCLUSIVE EDIT mode"
 
        elseif (isRead(m)) print m."Name" " is in READ ONLY mode"
 
        elseif (isShare(m)) print m."Name" " is in SHARED EDIT mode"
 
        }

 

 


Paul Miller
Melbourne, Australia

 

 

Re: Module handle if open from name string?
strathglass - Tue Mar 08 06:02:06 EST 2011

SystemAdmin - Mon Mar 07 17:01:56 EST 2011

If I've understood you correctly - the following will provide a module handle to the module variable "m". Then you can check for the open mode of the module.
 

string mname="/project1/module1"
ModName_ mnhModule=module(mname)
Module m
if ((!null(mnhModule)) && (open(mnhModule))) {
    m = module(item(mname))
        if (isEdit(m)) print m."Name" " is in EXCLUSIVE EDIT mode"
 
        elseif (isRead(m)) print m."Name" " is in READ ONLY mode"
 
        elseif (isShare(m)) print m."Name" " is in SHARED EDIT mode"
 
        }

 

 


Paul Miller
Melbourne, Australia

 

 

The line I need was: "m = module(item(mname))"

Thanks Paul.
-strathglass

Re: Module handle if open from name string?
bullbala - Tue Mar 08 06:25:39 EST 2011

strathglass - Tue Mar 08 06:02:06 EST 2011
The line I need was: "m = module(item(mname))"

Thanks Paul.
-strathglass

Paul, I generally use:
 

m = data moduleVersion mnhModule

 


instead of:

 

 

 

m = module item mname



Thanks for your suggestion.
However, I am not sure if there is any benefit using the former.